from django.template import Library
from bbd_admin.models import SiteSetting

register = Library()


@register.inclusion_tag(filename='templatetags/meta.html')
def set_meta():
    site_setting = SiteSetting.objects.filter().first()
    response = {
        'title': '',
        'keywords': '',
        'description': ''
    }
    if site_setting:
        response['title'] = site_setting.title
        response['keywords'] = site_setting.keywords
        response['description'] = site_setting.description
    return response
